/*  
* Copyright (c) 2010, James Daniello
* This project is licensed under the 'New BSD' license.
* The full text of the license can be found in the root
* directory under the filename "LICENSE.
"
*/

package src.objects;

import src.engine.PICAIUVector;

public abstract class PICAIUGameObject{

  protected double tMiddle, width, height;
  protected String animationName="";
  protected boolean active = true;
  protected boolean selectable = false;
  protected long id=-1;
  
  protected PICAIUVector position = new PICAIUVector();
  
  
  /**
  * Creates a new generic PICAIUGameObject
  */
  public PICAIUGameObject(String initAnim, double xIn, double yIn, long idIn){
    position.setX(xIn);
    position.setY(yIn);
    width=24;
    height=27;
    tMiddle=22;
    
    animationName=initAnim;
    id=idIn;
  }

  public PICAIUGameObject(){}
  
  /**
  * Updates the given game object with the elapsed time
  */
  public void update(long deltaT){
  }
  
  /**
  * Returns the x location as an int.
  */
  public double getX(){
    return position.getX();
  }
  
  /**
  * Returns the y location as an int.
  */
  public double getY(){
    return position.getY();
  }
  
  /**
  * Set the x position of this object
  */
  public void setX(double xIn){
    position.setX(xIn);
  }
  
  /**
  * Set the y position of this object
  */
  public void setY(double yIn){
    position.setY(yIn);
  }
  
  /**
  * Returns the point where an object below this appears in front of this object, and vice
  * versa. This is a simple one-point way of doing this, which may become obsolete.
  */
  public int getYMiddle(){
    return (int)(position.getY()+tMiddle);
  }
  
  /**
  * Returns the name of the current animation
  */
  public String getAnimationName(){
    return animationName;
  }

  /**
  * Returns whether or not this object is currently active
  */
  public boolean isActive(){
    return active;
  }
  
  public void setActive(boolean setActive){
    active = setActive;
  }
  
  /** Returns if this object can be selected with a mouse
  */
  public boolean isSelectable(){
    return selectable;
  } 
  
  /**
  * Returns the id of this object
  */
  public long getId(){
    return id;
  }
  
  /**
  * returns the offset required to line up this object in the selection veiwer
  */
  public int getViewerOffsetX(){
    return 0;
  }
  
  /**
  * returns the offset required to line up this object in the selection veiwer
  */
  public int getViewerOffsetY(){
    return 0;
  }
  
  /**
  *  Returns where the target cursor should be located for this object
  */
  public int getTargetLockX(){
    return (int)position.getX();
  }
  
  /**
  *  Returns where the target cursor should be located for this object
  */
  public int getTargetLockY(){
    return (int)position.getY();
  }


  //returns the center x of this object;
  public float getCenterX(){
      return (float)(position.getX()+width/2);
  }



  //returns the center y of this object;
  public float getCenterY(){
      return (float)(position.getY()+height/2);
  }


  public int getAnimOffX(){
      return 0;
  }
  public int getAnimOffY(){
      return 0;
  }

  public void setStatus(int status) {
  }

  public void setSpeed(float moveSpeed) {
  }

  public void setTargetX(double tx) {
    
  }

  public void setTargetY(double ty) {

  }
}